'Self-defence'
Authorities imposed a curfew in Kakopathar and many adjoining areas, as tension spread with news of the police firing.
According to police, thousands of protesters had converged on a police station and tried to burn it down.
"The mob was advancing on the local police station, forcing security forces to fire in self-defence," district police superintendent Debojit Hazarika was quoted by the Associated Press as saying.
Five demonstrators were killed in the shooting. The angry mob is then said to have killed two policemen.
The crowd was protesting at the death of Ajit Mahanta, who is believed to have links with Ulfa rebels.
Mr Mahanta died in military custody last week. Three army officials have faced disciplinary action over his death.
More than 10,000 people have died in the rebel group's fight for a separate homeland.
On Monday, Ulfa representatives held talks with senior Indian officials, after which the government said it would consider releasing some detained rebels and look into human rights complaints.